<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }
        .box {
            width: 400px;
            height: 300px;
            margin: 50px auto;

            position: relative;
        }

        .box img {
            width: 100%;
            height: 100%;

        }

        .box .box-1::before {
            content: '';
            width: 100%;
            height: 100%;
            position: absolute;
            left: 0;
            top: 0;
            box-sizing: border-box;
            border-top: 4px solid red;
            border-bottom: 4px solid red;
            transform: scale(0,1);
            transition: all 0.5s;
        }
        .box:hover .box-1::before{
            transform: scale(1,1);
        }
       

        .box .box-1::after {
            content: '';
            width: 100%;
            height: 100%;
            position: absolute;
            box-sizing: border-box;
            left: 0;
            top: 0;
            border-left: 4px solid red;
            border-right: 4px solid red;
            transform: scale(1,0);
            transition: all 0.5s;
        }
        .box:hover .box-1::after{
            transform: scale(1,1);
        }

.box .box-2::before{
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    background: rgba(0, 0, 0, 0.4);
    transform: scale(0);
    transition: all 0.5s;
    transform-origin: right top;
}
.box:hover .box-2::before{
    transform: scale(1);
}
.box .box-3::before{
    content: '';
    width: 100%;
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
    background: rgba(0, 0, 0, 0.4);
    transform: scale(0);
    transition: all 0.5s;
    transform-origin: left bottom ;
}
.box:hover .box-3::before{
    transform: scale(1);
}
    </style>
</head>

<body>

    <div class="box">
        <img src="images/keaimao.jpg" alt="">
        <div class="box-1"></div>
        <div class="box-2"></div>
        <div class="box-3"></div>
    </div>
</body>

</html>